load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "querywatch",
    srcs = ["query_watch.go"],
    importpath = "github.com/pingcap/tidb/pkg/executor/internal/querywatch",
    visibility = ["//pkg/executor:__subpackages__"],
    deps = [
        "//pkg/domain",
        "//pkg/executor/internal/exec",
        "//pkg/infoschema",
        "//pkg/parser",
        "//pkg/parser/ast",
        "//pkg/parser/model",
        "//pkg/planner/util",
        "//pkg/resourcegroup",
        "//pkg/resourcegroup/runaway",
        "//pkg/sessionctx",
        "//pkg/util/chunk",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_kvproto//pkg/resource_manager",
        "@com_github_tikv_pd_client//resource_group/controller",
    ],
)

go_test(
    name = "querywatch_test",
    timeout = "short",
    srcs = [
        "main_test.go",
        "query_watch_test.go",
    ],
    embed = [":querywatch"],
    flaky = True,
    deps = [
        "//pkg/config",
        "//pkg/errno",
        "//pkg/kv",
        "//pkg/meta/autoid",
        "//pkg/sessionctx/variable",
        "//pkg/testkit",
        "//pkg/testkit/testsetup",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//tikv",
        "@org_uber_go_goleak//:goleak",
    ],
)
